package com.segersten.kalaha.domain;

import java.io.Serializable;

public enum EventType implements Serializable{
	GAME_CREATED(0,"Game created"), 
	PLAYER_1_JOINED(1,"Player 1 joined"), 
	PLAYER_2_JOINED(1,"Player 2 joined"),
	PLAYER_1_ACTION(3,"Player 1 action"), 
	PLAYER_2_ACTION(4, "Player 2 action"), 
	GAME_FINISHED(5, "Game finished"),
	PLAYER_1_TIMEOUT(6, "Player 1 timeout"),
	PLAYER_2_TIMEOUT(7, "Player 2 timeout");
	
	private int code;
	private String name;
	private EventType(int code, String name) {
		this.code = code;
		this.name = name;
	}
	
	public int getCode() {
		return code;
	}

	public String getName() {
		return name;
	}
	
	public boolean isTimeout() {
		return this.equals(PLAYER_1_TIMEOUT) || this.equals(PLAYER_2_TIMEOUT);
	}
	
	
}
